package ClientStation;
import java.io.BufferedReader;
import java.io.InputStreamReader;

import javax.swing.JFrame;

import UI.*;
public class main {

	 
	/**
	 * @param args
	 */
	public static OperateurSystem.GestionAuthentification maGestionAuthentification;
	public static void main(String[] args) {
		try {

			// Intialisation de l'orb
			org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);



	        // Saisie du nom de l'objet (si utilisation du service de nommage)
	     
	        String idObj ="OperateurSystem";

	        // Recuperation du naming service
	        org.omg.CosNaming.NamingContext nameRoot =
	        		org.omg.CosNaming.NamingContextHelper.narrow(orb.resolve_initial_references("NameService"));

	        // Construction du nom a rechercher
	        org.omg.CosNaming.NameComponent[] nameToFind = new org.omg.CosNaming.NameComponent[1];
	         nameToFind[0] = new org.omg.CosNaming.NameComponent(idObj,"");

	        // Recherche aupres du naming service
	        org.omg.CORBA.Object CORoperateurSystem = nameRoot.resolve(nameToFind);
	        System.out.println("Objet '" + idObj + "' trouve aupres du service de noms. IOR de l'objet :");
	        System.out.println(orb.object_to_string(CORoperateurSystem));

	        // Utilisation directe de l'IOR (SAUF utilisation du service de nommage)
//	        org.omg.CORBA.Object distantEuro = orb.string_to_object("IOR:000000000000001b49444c3a436f6e766572746973736575722f4575726f3a312e300000000000010000000000000082000102000000000a3132372e302e302e3100e72e00000031afabcb0000000020a40e9e4900000001000000000000000100000008526f6f74504f410000000008000000010000000014000000000000020000000100000020000000000001000100000002050100010001002000010109000000010001010000000026000000020002");

	        // Casting de l'objet CORBA au type convertisseur euro
	        maGestionAuthentification = OperateurSystem.GestionAuthentificationHelper.narrow(CORoperateurSystem);


	        // TODO creer la station
	        // Appel de l'interface graphique
	        JFrame splash = new StationUI();
	        splash.setVisible(true);
		}
		catch (Exception e) {
			e.printStackTrace();
		}

			
	}

}
